/*
 * monarch.h
 *
 *  Created on: Dec 14, 2010
 *      Author: dt
 *
 *
 *      Extend this class to handle
 */

#ifndef MONARCH_CONTROLLER_H_
#define MONARCH_CONTROLLER_H_

#include "talk/base/fileutils.h"
#include "talk/base/pathutils.h"
#include "talk/base/helpers.h"
#include "talk/base/httpclient.h"
#include "talk/base/logging.h"
#include "talk/base/flags.h"
#include "talk/base/physicalsocketserver.h"
#include "talk/base/ssladapter.h"
#include "talk/xmpp/xmppclientsettings.h"
#include "talk/examples/login/xmppthread.h"
#include "talk/examples/login/xmppauth.h"
#include "talk/p2p/client/httpportallocator.h"
#include "talk/p2p/client/sessionmanagertask.h"
//#include "talk/session/fileshare/fileshare.h"
#include "presencepushtask.h"
#include "presenceouttask.h"
#include "jingleinfotask.h"
#include "talk/session/tunnel/tunnelsessionclient.h"
#include "PipeClient.h"
#include "Console.h"
#include "XMPPCallback.h"
#include "ConnectionCallback.h"


class MonarchController
{
public:
  MonarchController(XMPPCallback *xmppCallback,  std::string& username, std::string& password,  std::string& xmppServerAddress, bool& debug, cricket::MediaEngine*);


  XMPPCallback *xmppCallback_;
  //ConnectionCallback *connectionCallback_;
  PipeClient *pipe_client_;
  std::string username_;
  std::string password_;
  std::string server_;
  bool debug_;

  //XmppPump pump;

  bool requestTunnelTo(std::string& user, ConnectionCallback *conn);

  int getRoster( const char* buf, size_t size);

  void start( );

  int sendData(ConnectionCallback *conn,  const char* buf, size_t size);

  //int sendChatMessage( const char* buf, size_t size);

  void setXMPPStatus(std::string& status);

  void printRoster();


  virtual
  ~MonarchController();

  private:
    talk_base::Thread *main_thread_;
    XmppPump pump_;
    cricket::MediaEngine *media_engine_;
    buzz::XmppClientSettings *xcs_;
};

#endif /* MONARCH_CONTROLLER_H_ */
